<!-- 搜索详情 -->
<template>
	<view class="container">
		<view class="header">
			<text class="yticon icon-zuo" @tap="back"></text>
			<image class="headImg" :src="data.img" mode="aspectFill"></image>
		</view>
		<view class="content">
			<view class="title">
				<view class="a">
					{{data.title}}
					<text class="back" v-if="Number(data.keywords) > 1">{{data.keywords}}A景区</text>
					<text class="back a-a" v-else-if="Number(data.keywords) == 1">主题区</text>
					<text class="back b-b" v-else>免预约</text>
				</view>
			</view>
			<view class="address">
				<view class="a clamp">
					<uni-icons class="icon" type="location-filled" color="#999" size="16"></uni-icons>
					<text class="a-b">{{data.rmk2}}</text>
				</view>
				<view class="b" @tap="viewMap">
					<text class="b-a">地图</text>
					<text class="b-b yticon icon-you"></text>
				</view>
			</view>
			<view class="cont">
				<view class="tit">景区介绍</view>
				<text class="contText">{{data.content}}</text>
			</view>
		</view>
		<view class="btn" @tap="subscribe">
			预 约
		</view>
	</view>
</template>

<script>
	import {
		travelScenicInfo
	} from "@/api/user.js"
	export default {
		components: {},
		data() {
			return {
				id: 0,
				longitude: uni.getStorageSync("locatLongitude"),
				latitude: uni.getStorageSync("locatLatitude"),
				data: {}
			}
		},
		onLoad(options) {
			this.id = options.id
			travelScenicInfo({
				id: this.id,
				lng: this.longitude,
				lat: this.latitude
			}).then(res => {
				this.data = res.data
				var reg4= /(<\/?font.*?>)|(<\/?span.*?>)|(<\/?div.*?>)|(<\/?p.*?>)|(<\/?br.*?>)|(<\/?a.*?>)/gi
				this.data.content = this.data.content.replace(reg4, '')
			})
		},
		methods: {
			back() {
				uni.navigateBack({
					
				})
			},
			viewMap() {
				uni.openLocation({
					latitude: parseFloat(this.data.lat),
					longitude: parseFloat(this.data.lng),
					success: (res) => {
						console.log(res);
					}
				});
			},
			subscribe() {
				uni.navigateTo({
					url:"./tourismCardSub?title=" + this.data.title + "&id=" + this.data.id
				})
			}
		}
	}
</script>
<style>
	page{
		background: #fafafa;
	}
</style>
<style lang="scss" scoped>
	.container {
		padding-bottom: 70rpx;
		.header{
			height: 470rpx;
			position: relative;
			.yticon{
				position: absolute;
				//#ifdef H5
				top: 30rpx;
				//#endif
				//#ifdef APP-PLUS
				top: calc(var(--status-bar-height) + 30rpx);
				//#endif
				left: 30rpx;
				padding-left: 10rpx;
				width: 50rpx;
				height: 60rpx;
				text-align: center;
				line-height: 60rpx;
				color: #fff;
				background: rgba(0,0,0,.4);
				z-index: 1;
				border-radius: 50%;
			}
			.headImg{
				width: 100%;
				height: 100%;
			}
		}
		.content{
			background: #fafafa;
			position: relative;
			margin-top: -30rpx;
			padding: 30rpx;
			border-radius: 30rpx 30rpx 0px 0px;
			z-index: 2;
			.title{
				margin-bottom: 30rpx;
				.a{
					font-size: 42rpx;
					font-weight: bold;
					color: #333333;
					margin-right: 10rpx;
				}
				.back {
					position: relative;
					bottom: 4rpx;
					padding:3rpx 10rpx;
					background: #E5F9E9;
					text-align: center;
					border-radius: 10rpx;
					font-size: 20rpx;
					font-weight: normal;
					color: #57BE6A;
					margin-left: 8rpx;
				}
				.a-a{
					background: #FFF0EE;
					color: #FC7D68;
				}
				.b-b{
					background: #FFEFE1;
					color: #F89034;
				}
			}
			.address{
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 28rpx;
				.a{
					flex: 1;
					color: #666;
					.a-b{
						margin-left: 10rpx;
					}
				}
				.b{
					margin-left: 10rpx;
					color: #57BE6A;
					.yticon{
						margin-left: 4rpx;
						font-size: 20rpx;
					}
				}
			}
			.cont{
				padding: 40rpx 25rpx;
				border-radius: 10rpx;
				background: #fff;
				margin-top: 50rpx;
				.tit{
					font-size: 30rpx;
					font-weight: bold;
					color: #333333;
					margin-bottom: 30rpx;
				}
				.contText{
					display: block;
					font-size: 28rpx;
					color: #666666;
					text-align: justify;
					line-height: 48rpx;
				}
			}
		}
		.btn{
			margin: 100rpx auto 0;
			width: 600rpx;
			height: 80rpx;
			background: linear-gradient(90deg, #FBCC2B 0%, #FBDC72 100%);
			border-radius: 40rpx;
			text-align: center;
			line-height: 80rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
		}
	}
</style>
